import Vue from 'vue'
import Router from 'vue-router'

// const originalPush = Router.prototype.push
// Router.prototype.push = function push(location) {
//    return originalPush.call(this, location).catch(err => err)
// }
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'index',
      component: resolve => {require(['@/pages/index'], resolve)},
      meta:{
        title:'小贺也要加油啊'
      }
    },
    {
      path: '/login',
      name: 'login',
      component: resolve => {require(['@/pages/login'], resolve)},
      meta:{
        title:'登录'
      }
    },
    {
      path: '/project',
      name: 'project',
      component: resolve => {require(['@/pages/project'], resolve)},
      meta:{
        title:'项目'
      }
    },
    {
      path: '/news',
      name: 'news',
      component: resolve => {require(['@/pages/news'], resolve)},
      meta:{
        title:'博客'
      }
    },
    { path: '*', component: resolve => {require(['@/pages/404'], resolve)}}
  ],
  mode:'hash'
})
